package com.situ.ssh.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import com.situ.ssh.entity.Admin;
import com.situ.ssh.service.IAdminService;

@Controller
@Scope("prototype")
public class AdminAction extends ActionSupport implements ModelDriven<Admin> {
	@Autowired
	private IAdminService adminService;
	//通过模型驱动方式注入
	private Admin admin = new Admin();
	
	public String login() {
		Admin loginAdmin = adminService.login(admin);
		System.out.println("Login Admin: " + loginAdmin);
		return "loginSucces";
	}

	@Override
	public Admin getModel() {
		return admin;
	}
}
